package org.jeecg.modules.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.system.entity.ZkEquipmentService;
import org.jeecg.modules.system.entity.ZkEquipmentServiceDetail;
import org.jeecg.modules.system.mapper.ZkEquipmentServiceMapper;
import org.jeecg.modules.system.service.IZkEquipmentServiceService;
import org.springframework.stereotype.Service;

/**
 * @Description: 设备信息表
 * @Author: jeecg-boot
 * @Date:   2024-04-29
 * @Version: V1.0
 */
@Service
public class ZkEquipmentServiceServiceImpl extends ServiceImpl<ZkEquipmentServiceMapper, ZkEquipmentService> implements IZkEquipmentServiceService {

    /**
     * 审批界面/维修（根据当前登录人和状态分页查询）
     * @return
     */
    @Override
    public IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceDetail(Integer pageNo, Integer pageSize) {
        //获取系统当前登录人
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

        Page<ZkEquipmentServiceDetail> page = new Page<ZkEquipmentServiceDetail>(pageNo,pageSize);

        return this.baseMapper.queryZkEquipmentServiceDetail(page,sysUser.getId());
    }


    /**
     * 发起界面/维修（根据当前登录人和状态分页查询）
     * @return
     */
    @Override
    public IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceList(Integer pageNo, Integer pageSize) {
        //获取系统当前登录人
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

        Page<ZkEquipmentServiceDetail> page = new Page<ZkEquipmentServiceDetail>(pageNo,pageSize);

        return this.baseMapper.queryZkEquipmentServiceList(page,sysUser.getId());
    }

    /**
     *抄送任务(维修)（根据当前登录人和状态将维修，保养，检修放在同一个分页查询中）
     */
    @Override
    public IPage<ZkEquipmentServiceDetail> queryZkEquipmentServiceCc(Integer pageNo, Integer pageSize) {
        //获取系统当前登录人
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

        Page<ZkEquipmentServiceDetail> page = new Page<ZkEquipmentServiceDetail>(pageNo,pageSize);

        return this.baseMapper.queryZkEquipmentServiceCc(page,sysUser.getId());
    }
}
